using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace DictGen
{
    public class Globals
    {
        /// <summary>
        /// The following table is used to check whether a given character code is a 
        /// valid urdu character or not. This is specially important for compiling
        /// word lists by scanning urdu documents as most of the documents on the internet 
        /// either contain english eords and sometimes the urdu words are written using 
        /// characters from Arabic or Persian alphabets that look similar but have different 
        /// underlying codes
        /// </summary>
        /// <remarks>
        /// The following codes were taken from the Urdu Collation application provided
        /// by CRULP. The application source code can be found at 
        /// http://www.crulp.org/software/langproc/urducollation.htm. All characters 
        /// codes supported by this application have been considered valid urdu characters
        /// and included in the following table.
        /// </remarks> 
        public static readonly int[] CRULP_APPROVED_CODES = {
            0x600, 0x601, 0x602, 0x603, 0x60C, 0x60D, 0x60E, 0x60F, 0x610, 0x611, 
            0x612, 0x613, 0x614, 0x615, 0x61B, 0x61F, 0x621, 0x622, 0x623, 0x624, 
            0x626, 0x627, 0x628, 0x62A, 0x62B, 0x62C, 0x62D, 0x62E, 0x62F, 0x630, 
            0x631, 0x632, 0x633, 0x634, 0x635, 0x636, 0x637, 0x638, 0x639, 0x63A, 
            0x641, 0x642, 0x644, 0x645, 0x646, 0x648, 0x64B, 0x64C, 0x64D, 0x64E, 
            0x64F, 0x650, 0x651, 0x652, 0x653, 0x654, 0x656, 0x657, 0x658, 0x66A, 
            0x66B, 0x66C, 0x670, 0x679, 0x67E, 0x686, 0x688, 0x691, 0x698, 0x6A9, 
            0x6AF, 0x6BA, 0x6BE, 0x6C1, 0x6C2, 0x6C3, 0x6CC, 0x6D2, 0x6D4, 0x6F0, 
            0x6F1, 0x6F2, 0x6F3, 0x6F4, 0x6F5, 0x6F6, 0x6F7, 0x6F8, 0x6F9, 0x200C
        };

        public static readonly int[] AARAB= {
        };

        public static bool IsNumeric(string word)
        {
            double test;

            return double.TryParse(word, out test);
        }

        public static bool IsInteger(string word)
        {
            int test;

            return int.TryParse(word, out test);
        }

        public static bool ContainsEnglishCharacters(string word)
        {
            foreach (char c in word.ToCharArray())
            {
                if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
                    return true;
            }

            return false;
        }


    }
}
